#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName  :Str2Time_44.py
# @Time      :2020/6/24 9:28
# @Author    :Administrator
import time
import datetime

'''将字符串的时间转换为时间戳'''

a1 = '2019-5-10 23:40:00'
timeArray = time.strptime(a1, "%Y-%m-%d %H:%M:%S")
# print(timeArray)
timeStamp = int(time.mktime(timeArray))
print(timeStamp)

a2 = '2019-5-10 23:40:00'
timeArray = time.strptime(a2, "%Y-%m-%d %H:%M:%S")
otherStyleTime = time.strftime('%Y/%m/%d %H:%M:%S', timeArray)
print(otherStyleTime)

nowTime = datetime.datetime.now()
print(nowTime.strftime('%Y/%m/%d %H:%M:%S'))
